import { ThemeConfig } from 'antd';

import { ThemeColorPresets } from '@/types/enum';
/**
 * Antd theme editor: https://ant.design/theme-editor-cn
 */
const customThemeTokenConfig: ThemeConfig['token'] = {
  // colorSuccess: '#22c55e',
  // colorWarning: '#ff7849',
  colorInfo: '#0080FF',

  // 主色
  colorPrimary: '#1B6DFA',
  colorPrimaryActive: '#024BD2',

  // 错误色
  colorError: '#FC5151',
  colorErrorActive: '#CF3429',
  colorErrorHover: '#FF706E',

  // 禁用
  // colorBgContainerDisabled: '#011B4612',
  // colorTextDisabled: '#989A9E',

  // 线性化
  wireframe: false,

  colorSuccess: '#04C273',
  colorWarning: '#FF9226',

  borderRadiusSM: 4,
  borderRadius: 6,
  borderRadiusLG: 12,
  colorBgBase: '#FBFCFF',
};

const customComponentConfig: ThemeConfig['components'] = {
  Breadcrumb: {
    fontSize: 14,
    separatorMargin: 4,
  },
  Menu: {
    fontSize: 14,
    colorFillAlter: 'transparent',
    // itemColor: '#1D2129',
    itemColor: '#4E5969',
    motionDurationMid: '0.125s',
    motionDurationSlow: '0.125s',
    itemHoverColor: '#1D2129',
    itemHoverBg: '#F3F5F9',
    itemBorderRadius: 6,
    itemSelectedBg: '#F3F5F9',
    itemSelectedColor: '#1B6DFA',
    // 新增自定义样式属性
    itemHoverFontWeight: 600,       // 悬浮时字体加粗
    itemSelectedFontWeight: 600,    // 选中时字体加粗
    // 设置默认字体粗细
    itemFontWeight: 400,
  },
  Layout: {
    colorBgLayout: '#F2F3F5',
  },
  Card: {
    borderRadius: 6,
    padding: 16,
    paddingLG: 16,
  },
  Button: {
    borderRadius: 6,
    contentFontSize: 14,
    contentLineHeight: 22,
  },
  Select: {
    borderRadius: 6,
  },
  Input: {
    borderRadius: 6,
    activeBorderColor: '#0080FF',
    colorBorder: '#E5E6EB',
    colorText: '#1D2129',
    colorTextDisabled: '#C9CDD4',
  },
  Tabs: {
    fontSize: 16,
    itemColor: '#4E5969',
    itemHoverColor: '#1D2129',
    horizontalItemPadding: ' 12px 0 16px 0',
  },
  Form: {
    itemMarginBottom: 16,
  },
  Segmented: {
    itemSelectedBg: '#F7F8FA',
    itemSelectedColor: '#1B6DFA',
  },
  Collapse: {
    colorBorder: 'transparent',
    headerBg: 'transparent',
  },
  Alert: {
    colorInfoBg: '#F0F7FF',
    colorInfoBorder: '#BADDFF',
    colorText: '#1D2129'
  },
  Tag: {
    defaultColor: '#4E5969',
    colorBorder: '#E5E7EB',
    defaultBg: '#fff',
  },
  Divider: {
    margin: 16,
  },
  Tooltip: {
    colorText: '#000000',
    borderRadius: 6,
    paddingLG: 16,
    padding: 16,
    fontSize: 14,
    controlOutlineWidth: 0,
    colorBgSpotlight: 'white',
    colorTextLightSolid: '#000',
  },
  Table: {
    headerBg: '#F7F8FA',
    headerColor: '#86909C',
    cellPaddingInline: 12,
    cellPaddingBlock: 12,
    headerSplitColor: 'transparent',
    headerBorderRadius: 6,
    rowSelectedHoverBg: '#F2F3F5',
    rowSelectedBg: '#F2F3F5',
    rowExpandedBg: 'transparent',
    expandIconBg: '#E5E6EB'
  },
  Dropdown: {
    controlItemBgHover: '#F7F8FA',
    borderRadiusSM: 4,
    marginXXS: 8,
    marginXS: 12,
  }
};

const colorPrimarys: {
  [k in ThemeColorPresets]: string;
} = {
  default: '#00a76f',
  cyan: '#078DEE',
  purple: '#6640FF',
  // purple: '#985ae1',
  blue: '#2065D1',
  orange: '#FDA92D',
  red: '#FF3030',
};

const themeModeToken: Record<'dark' | 'light', ThemeConfig> = {
  dark: {
    token: {
      colorBgLayout: 'red',
      colorBgContainer: '#212b36',
      colorBgElevated: '#161c24',
    },
    components: {
      Modal: {
        headerBg: '#212b36',
        contentBg: '#212b36',
        footerBg: '#212b36',
      },
      Notification: {},
    },
  },
  light: {},
};

export { customThemeTokenConfig, customComponentConfig, colorPrimarys, themeModeToken };
